package com.xushi.service.impl;

import com.xushi.dao.UserInfoRepository;
import com.xushi.model.UserInfo;
import com.xushi.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Autowired
    private UserInfoRepository userInfoDao;


    @Override
    public UserInfo findUserInfoByOpenId(String openId) {
        return userInfoDao.findUserInfoByOpenId(openId);
    }

    @Override
    public void saveOrUpdateUserInfo(String openId, String trueName, String phoneNumber) {
        UserInfo userInfo = new UserInfo(openId, trueName, phoneNumber);
        userInfoDao.save(userInfo);
    }
}
